package pkg

import (
	"github.com/gin-gonic/gin"
	"strconv"
)

// 分页
func Pages(c *gin.Context) (int, int) {
	page := c.Query("page")
	limit := c.Query("limit")
	pageInt, _ := strconv.Atoi(page)
	limitInt, _ := strconv.Atoi(limit)
	if pageInt == 0 {
		pageInt = 1
	}
	if limitInt == 0 {
		limitInt = 5
	}
	offset := (pageInt - 1) * limitInt
	return offset, limitInt
}
